package com.weixin.config;

import com.jfinal.config.*;
import com.jfinal.core.JFinal;
import com.jfinal.kit.PropKit;
import com.jfinal.render.ViewType;
import com.jfinal.template.Engine;
import com.jfinal.weixin.sdk.api.ApiConfigKit;
import com.weixin.controller.IndexController;
import com.weixin.controller.WeixinApiController;
import com.weixin.controller.WeixinMsgController;

public class WeixinConfig extends JFinalConfig {
    public void configConstant(Constants constants) {
        PropKit.use("weixin_config.txt");
        constants.setEncoding("utf-8");
        constants.setViewType(ViewType.JSP);
        // ApiConfigKit 设为开发模式可以在开发阶段输出请求交互的 xml 与 json 数据
        ApiConfigKit.setDevMode(constants.getDevMode());
    }

    public void configRoute(Routes routes) {
        routes.add("/msg", WeixinMsgController.class);
        routes.add("/", IndexController.class,"/index");
        routes.add("/api", WeixinApiController.class);
    }

    public void configEngine(Engine engine) {

    }

    public void configPlugin(Plugins plugins) {

    }

    public void configInterceptor(Interceptors interceptors) {

    }

    public void configHandler(Handlers handlers) {

    }
    public static void main(String[] args) {
        JFinal.start("src/main/webapp", 8080, "/", 5);
    }
}
